#include <bits/stdc++.h>
using namespace std;
int main(){
	freopen("candy.in","r",stdin);
	freopen("candy.out","w",stdout);
	long long n,l,r;
	cin>>n>>l>>r;
	long long maxx=0;
	long long h=l/n;
	l%=n;
	r-=h*n;
	for(long long k=l;k<=r;k++){
		if(k<n) maxx=max(k,maxx);
		else continue;
	}
	cout<<maxx<<endl;
	return 0;
}
